1. Field of the Invention
The present invention relates to a method and apparatus for correctly detecting bar code data independently of surface noise or a printing method in a scanner device which reads bar code data by use of a reflected laser beam, for instance.
2. Description of the Prior Art
Recently, POS (point of sales) systems incorporating an automatic reading type register are widely employed instead of conventional key-in type registers in a variety of stores from major stores such as department stores and supermarkets to retail stores.
While the conventional key-in type register has only the function of calculating an amount of money of a customer's purchase immediately and correctly, the POS system has functions of calculating and adjusting amounts of money of purchases, and managing, in a unified manner, sales information, delivery and laying-in information, stock information, etc. of individual goods.
The POS system employs the bar code scheme for the input of an amount of money of a customer's purchase. According to the bar code scheme, a bar code representing a classification code that indicates attributes of each product is attached to it. When inputting an amount of money of a customer's purchase, a store clerk operates a bar code reader to read bar codes attached to respective products. The POS system judges prices of respective products based on classification codes as read by the bar code reader, and has the prices displayed on a display device of a POS terminal installed at a register counter. Further, the POS system calculates the total amount of money of the purchased products, and has it displayed on the display device of the POS terminal.
The bar code scheme not only saves a clerk the time and labor of inputting a classification code and a price of every product, but also prevents erroneous inputs. Further, the bar code scheme has the advantages that it can be implemented by a simple logic at a low cost, and that it can provide high reading accuracy because printed bars are a subject of reading.
The bar code reader is a device which illuminates a bar code with a light beam such as a laser beam, and judges widths of bars by analyzing the light reflected by the bars.
On the other hand, a format according to UPC (universal product code) is generally used for bar codes. UPC is compatible with JAN (Japanese article number) that is standardized in the JIS standard, and EAN (European article number) that is standardized in Europe.
UPC prescribes that a bar code should consist of 13 characters in the standard format and 8 characters in the contracted format. FIG. 11 shows the UPC's standard format consisting of 13 characters.
A bar code according to UPC has a left-side guide bar (LGB) and a right-side guide bar (RGB) at left and right end portions, respectively, and a center bar (CB) at a central portion. Further, UPC prescribes that a bar code should have margin portions which are wider than a particular width outside the left-side and right-side guide bars, respectively.
A group of six bar characters (hereinafter referred to as "left-side data block") written between the left-side guide bar (LGB) and the center bar (CB) according to UPC usually indicates a maker identification code of a product. On the other hand, right-side five bar characters (hereinafter referred to as "right-side data block") of another group of bar characters written between the center bar (CB) and the right-side guide bar (RGB) usually indicates a product item identification code, and the remaining one bar character indicates a modular check character.
A bar code reader can demodulate bar characters of the left-side and right-side data blocks into a prescribed data format only when it successfully scans the left-side and right-side margin portions and the left-side and right-side guide bars. More specifically, the bar code reader scans a bar code, detects bar widths of respective bar characters, and stores a data group of bar widths into a data buffer. Then, the bar code reader retrieves, in a predetermined direction, the bar width data group that is stored in the data buffer, and recognizes the left-side and right-side margin portions, the left-side and right-side guide bars and the center bar. That is, the bar code reader detects the positions of the margin portions, guide bars and center bar by retrieving the bar width data group based on the widths of the margin portions, guard bars and center bar that are prescribed by UPC. For example, when retrieving the bar width data group in the left-to-right direction of the bar code, the bar code reader sequentially recognizes the left-side margin portion, left-side guide bar (LGB), center bar (CB), right-side guide bar (RGB) and right-side margin portion. Then, the bar code reader judges whether the left-side data block exists between the left-side guard bar (LGB) and the center bar(CB), and whether the right-side data block exists between the center bar (CB) and the right-side guard bar (RGB). If there exist both of the left-side and right-side data blocks, the bar code reader demodulates the bar width data on a block-by-block basis.
Conventional bar code readers have a problem that when dirt or the like is attached to the left-side margin portion, they cannot detect the left-side margin portion and the left-side guard bar (LGB) and, therefore, cannot demodulate the bar width data of the left-side data block.
Further, when the width of the right-side margin portion is smaller than the prescribed value of UPC because of a product shape etc., conventional bar code readers cannot detect the right-side margin portion and the right-side guard bar (RGB) and, therefore, cannot demodulate the bar width data of the right-side data block.